<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
       xmlns:p="http://primefaces.org/ui"
       xmlns:ui="http://java.sun.com/jsf/facelets" 
      xmlns:composite="http://java.sun.com/jsf/composite">
      
	<composite:interface componentType="menuAuteq">
		<composite:attribute name="id"/>
		<composite:attribute name="nome"/>		
		<composite:attribute name="url"/>
		<composite:attribute name="image"/>
		<composite:attribute name="renderizar" default="true"/>
		<composite:attribute name="breadCrumb" default="false"/>
	</composite:interface>
	
	<composite:implementation>	
	
		<h:form id="menu-item" prependId="false">			
		
		<f:metadata>
    		<f:event listener="#{menuController.validarBreadCrumb}" type="preRenderView" />
		</f:metadata>
		
		<p:remoteCommand name="atualizarBreadCrumb"
						actionListener="#{cc.validarBreadCrumb}"
						update="breadCrumb"/>
			
			<ui:fragment rendered="#{not cc.attrs.breadCrumb}">
				
				<li id="#{cc.attrs.id}" style="list-style-type:none">
					<p:commandLink action="#{cc.redirecionar}" rendered="#{cc.attrs.renderizar}" title="#{cc.attrs.nome}" update="@this">	
			     		<f:setPropertyActionListener target="#{cc.nome}" value="#{cc.attrs.nome}"/>
						<f:setPropertyActionListener target="#{cc.url}" value="#{request.contextPath}/#{cc.attrs.url}"/>						
						<p:graphicImage value="#{cc.attrs.image}" rendered="#{not empty  cc.attrs.image}"/>	
						<div align="center">
							<h:outputText value="#{cc.attrs.nome}" styleClass="#{not empty cc.attrs.image ? 'label_menu' : ''}" />
						</div>
					</p:commandLink>								
				</li>
				
			</ui:fragment>
								
			<ui:fragment rendered="#{cc.attrs.breadCrumb}">				
				<div class="breadCrumb">
					<ui:repeat id="breadCrumb" varStatus="iten" value="#{cc.breadCrumbList}" var="breadCrumbItem">						
						<p:commandLink action="#{cc.redirecionar}" title="#{breadCrumbItem.nome}" update="@this, @all">	
			     			<f:setPropertyActionListener target="#{cc.nome}" value="#{breadCrumbItem.nome}"/>
							<f:setPropertyActionListener target="#{cc.url}" value="#{breadCrumbItem.url}"/>																	 
							<h:outputText  value="#{breadCrumbItem.nome}"/>>					
						</p:commandLink>		
					</ui:repeat>
				</div>						
			</ui:fragment>
			
		</h:form>	
		
	</composite:implementation>
</html>